<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Gem::Commands::UpdateCommand - rubygems: Ruby Standard Library Documentation</title>


<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<script src="../../js/jquery-3.2.0.min.js"></script>

<script src="../../js/vue.min.js"></script>
<script src="../../js/js.cookie.min.js"></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../css/rdoc.css" rel="stylesheet">
<link href="../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
  var darkModeCsseHref = "../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="../Command.html">Gem::Command</a>
</div>

        
<div id="includes-section" class="nav-section">
  <h3>Included Modules</h3>

  <ul class="link-list">
    <li><a class="include" href="../InstallUpdateOptions.html">Gem::InstallUpdateOptions</a>
    <li><a class="include" href="../LocalRemoteOptions.html">Gem::LocalRemoteOptions</a>
    <li><a class="include" href="../VersionOption.html">Gem::VersionOption</a>
  </ul>
</div>

        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li class="calls-super" ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-execute">#execute</a>
    <li ><a href="#method-i-oldest_supported_version">#oldest_supported_version</a>
    <li ><a href="#method-i-preparing_gem_layout_for">#preparing_gem_layout_for</a>
    <li ><a href="#method-i-rubygems_target_version">#rubygems_target_version</a>
    <li ><a href="#method-i-update_gem">#update_gem</a>
    <li ><a href="#method-i-update_gems">#update_gems</a>
    <li ><a href="#method-i-update_rubygems">#update_rubygems</a>
    <li ><a href="#method-i-which_to_update">#which_to_update</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Gem::Commands::UpdateCommand">
    <h1 id="class-Gem::Commands::UpdateCommand" class="class">
      class Gem::Commands::UpdateCommand
    </h1>

    <section class="description">
    
    </section>

      <section id="5Buntitled-5D" class="documentation-section">





                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              
                                <div class="method-calls-super">
                                  Calls superclass method
                                  <a href="../Command.html#method-c-new"><code>Gem::Command::new</code></a>
                              </div>

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File rubygems/commands/update_command.rb, line 22</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>
  <span class="ruby-identifier">options</span> = {
    <span class="ruby-value">:force</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">false</span>,
  }

  <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">install_update_options</span>)

  <span class="ruby-keyword">super</span> <span class="ruby-string">&quot;update&quot;</span>, <span class="ruby-string">&quot;Update installed gems to the latest version&quot;</span>, <span class="ruby-identifier">options</span>

  <span class="ruby-identifier">add_install_update_options</span>

  <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">accept</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
    <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">value</span>

    <span class="ruby-identifier">value</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">add_option</span>(<span class="ruby-string">&quot;--system [VERSION]&quot;</span>, <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>,
             <span class="ruby-string">&quot;Update the RubyGems system software&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">value</span>, <span class="ruby-identifier">opts</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">value</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">true</span>

    <span class="ruby-identifier">opts</span>[<span class="ruby-value">:system</span>] = <span class="ruby-identifier">value</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">add_local_remote_options</span>
  <span class="ruby-identifier">add_platform_option</span>
  <span class="ruby-identifier">add_prerelease_option</span> <span class="ruby-string">&quot;as update targets&quot;</span>

  <span class="ruby-ivar">@updated</span>   = []
  <span class="ruby-ivar">@installer</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-execute" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">execute</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="execute-source">
            <pre><span class="ruby-comment"># File rubygems/commands/update_command.rb, line 97</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">execute</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:system</span>]
    <span class="ruby-identifier">update_rubygems</span>
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">gems_to_update</span> = <span class="ruby-identifier">which_to_update</span>(
    <span class="ruby-identifier">highest_installed_gems</span>,
    <span class="ruby-identifier">options</span>[<span class="ruby-value">:args</span>].<span class="ruby-identifier">uniq</span>
  )

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:explain</span>]
    <span class="ruby-identifier">say</span> <span class="ruby-string">&quot;Gems to update:&quot;</span>

    <span class="ruby-identifier">gems_to_update</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name_tuple</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">say</span> <span class="ruby-node">&quot;  #{name_tuple.full_name}&quot;</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">say</span> <span class="ruby-string">&quot;Updating installed gems&quot;</span>

  <span class="ruby-identifier">updated</span> = <span class="ruby-identifier">update_gems</span> <span class="ruby-identifier">gems_to_update</span>

  <span class="ruby-identifier">installed_names</span> = <span class="ruby-identifier">highest_installed_gems</span>.<span class="ruby-identifier">keys</span>
  <span class="ruby-identifier">updated_names</span> = <span class="ruby-identifier">updated</span>.<span class="ruby-identifier">map</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:name</span>)
  <span class="ruby-identifier">not_updated_names</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:args</span>].<span class="ruby-identifier">uniq</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">updated_names</span>
  <span class="ruby-identifier">not_installed_names</span> = <span class="ruby-identifier">not_updated_names</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">installed_names</span>
  <span class="ruby-identifier">up_to_date_names</span> = <span class="ruby-identifier">not_updated_names</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">not_installed_names</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">updated</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">say</span> <span class="ruby-string">&quot;Nothing to update&quot;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">say</span> <span class="ruby-node">&quot;Gems updated: #{updated_names.join(&quot; &quot;)}&quot;</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">say</span> <span class="ruby-node">&quot;Gems already up-to-date: #{up_to_date_names.join(&quot; &quot;)}&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">up_to_date_names</span>.<span class="ruby-identifier">empty?</span>
  <span class="ruby-identifier">say</span> <span class="ruby-node">&quot;Gems not currently installed: #{not_installed_names.join(&quot; &quot;)}&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">not_installed_names</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-preparing_gem_layout_for" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">preparing_gem_layout_for</span><span
                                class="method-args">(version) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="preparing_gem_layout_for-source">
            <pre><span class="ruby-comment"># File rubygems/commands/update_command.rb, line 195</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">preparing_gem_layout_for</span>(<span class="ruby-identifier">version</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">version</span>) <span class="ruby-operator">&gt;=</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;3.2.a&quot;</span>)
    <span class="ruby-keyword">yield</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">require</span> <span class="ruby-string">&quot;tmpdir&quot;</span>
    <span class="ruby-identifier">tmpdir</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">mktmpdir</span>
    <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mv</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">plugindir</span>, <span class="ruby-identifier">tmpdir</span>

    <span class="ruby-identifier">status</span> = <span class="ruby-keyword">yield</span>

    <span class="ruby-keyword">if</span> <span class="ruby-identifier">status</span>
      <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_rf</span> <span class="ruby-identifier">tmpdir</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mv</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">tmpdir</span>, <span class="ruby-string">&quot;plugins&quot;</span>), <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">plugindir</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">status</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-rubygems_target_version" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">rubygems_target_version</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="rubygems_target_version-source">
            <pre><span class="ruby-comment"># File rubygems/commands/update_command.rb, line 215</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">rubygems_target_version</span>
  <span class="ruby-identifier">version</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:system</span>]
  <span class="ruby-identifier">update_latest</span> = <span class="ruby-identifier">version</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">true</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">update_latest</span>
    <span class="ruby-identifier">version</span>     = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span>     <span class="ruby-identifier">version</span>
    <span class="ruby-identifier">requirement</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Requirement</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">version</span>

    <span class="ruby-keyword">return</span> <span class="ruby-identifier">version</span>, <span class="ruby-identifier">requirement</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">version</span>     = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span>     <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">VERSION</span>
  <span class="ruby-identifier">requirement</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Requirement</span>.<span class="ruby-identifier">new</span> <span class="ruby-node">&quot;&gt;= #{Gem::VERSION}&quot;</span>

  <span class="ruby-identifier">rubygems_update</span>         = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-identifier">rubygems_update</span>.<span class="ruby-identifier">name</span>    = <span class="ruby-string">&quot;rubygems-update&quot;</span>
  <span class="ruby-identifier">rubygems_update</span>.<span class="ruby-identifier">version</span> = <span class="ruby-identifier">version</span>

  <span class="ruby-identifier">highest_remote_tup</span> = <span class="ruby-identifier">highest_remote_name_tuple</span>(<span class="ruby-identifier">rubygems_update</span>)
  <span class="ruby-identifier">target</span> = <span class="ruby-identifier">highest_remote_tup</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">highest_remote_tup</span>.<span class="ruby-identifier">version</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">version</span>

  [<span class="ruby-identifier">target</span>, <span class="ruby-identifier">requirement</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-update_gem" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">update_gem</span><span
                                class="method-args">(name, version = Gem::Requirement.default)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="update_gem-source">
            <pre><span class="ruby-comment"># File rubygems/commands/update_command.rb, line 239</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">update_gem</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">version</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Requirement</span>.<span class="ruby-identifier">default</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@updated</span>.<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">spec</span><span class="ruby-operator">|</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">name</span> }

  <span class="ruby-identifier">update_options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-identifier">update_options</span>[<span class="ruby-value">:prerelease</span>] = <span class="ruby-identifier">version</span>.<span class="ruby-identifier">prerelease?</span>

  <span class="ruby-ivar">@installer</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">DependencyInstaller</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">update_options</span>

  <span class="ruby-identifier">say</span> <span class="ruby-node">&quot;Updating #{name}&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:system</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:silent</span>]
  <span class="ruby-keyword">begin</span>
    <span class="ruby-ivar">@installer</span>.<span class="ruby-identifier">install</span> <span class="ruby-identifier">name</span>, <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Requirement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">version</span>)
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">InstallError</span>, <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">DependencyError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
    <span class="ruby-identifier">alert_error</span> <span class="ruby-node">&quot;Error installing #{name}:\n\t#{e.message}&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-ivar">@installer</span>.<span class="ruby-identifier">installed_gems</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spec</span><span class="ruby-operator">|</span>
    <span class="ruby-ivar">@updated</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">spec</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-update_gems" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">update_gems</span><span
                                class="method-args">(gems_to_update)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="update_gems-source">
            <pre><span class="ruby-comment"># File rubygems/commands/update_command.rb, line 259</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">update_gems</span>(<span class="ruby-identifier">gems_to_update</span>)
  <span class="ruby-identifier">gems_to_update</span>.<span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name_tuple</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">update_gem</span> <span class="ruby-identifier">name_tuple</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">name_tuple</span>.<span class="ruby-identifier">version</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-ivar">@updated</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-update_rubygems" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">update_rubygems</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Update RubyGems software to the latest version.</p>

                              <div class="method-source-code" id="update_rubygems-source">
            <pre><span class="ruby-comment"># File rubygems/commands/update_command.rb, line 270</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">update_rubygems</span>
  <span class="ruby-keyword">if</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">disable_system_update_message</span>
    <span class="ruby-identifier">alert_error</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">disable_system_update_message</span>
    <span class="ruby-identifier">terminate_interaction</span> <span class="ruby-value">1</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">check_update_arguments</span>

  <span class="ruby-identifier">version</span>, <span class="ruby-identifier">requirement</span> = <span class="ruby-identifier">rubygems_target_version</span>

  <span class="ruby-identifier">check_latest_rubygems</span> <span class="ruby-identifier">version</span>

  <span class="ruby-identifier">check_oldest_rubygems</span> <span class="ruby-identifier">version</span>

  <span class="ruby-identifier">installed_gems</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">find_all_by_name</span> <span class="ruby-string">&quot;rubygems-update&quot;</span>, <span class="ruby-identifier">requirement</span>
  <span class="ruby-identifier">installed_gems</span> = <span class="ruby-identifier">update_gem</span>(<span class="ruby-string">&quot;rubygems-update&quot;</span>, <span class="ruby-identifier">version</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">installed_gems</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">installed_gems</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">version</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">version</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">installed_gems</span>.<span class="ruby-identifier">empty?</span>

  <span class="ruby-identifier">install_rubygems</span> <span class="ruby-identifier">installed_gems</span>.<span class="ruby-identifier">first</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-which_to_update" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">which_to_update</span><span
                                class="method-args">(highest_installed_gems, gem_names)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="which_to_update-source">
            <pre><span class="ruby-comment"># File rubygems/commands/update_command.rb, line 303</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">which_to_update</span>(<span class="ruby-identifier">highest_installed_gems</span>, <span class="ruby-identifier">gem_names</span>)
  <span class="ruby-identifier">result</span> = []

  <span class="ruby-identifier">highest_installed_gems</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">_l_name</span>, <span class="ruby-identifier">l_spec</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">gem_names</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span>
            <span class="ruby-identifier">gem_names</span>.<span class="ruby-identifier">none?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">l_spec</span>.<span class="ruby-identifier">name</span> }

    <span class="ruby-identifier">highest_remote_tup</span> = <span class="ruby-identifier">highest_remote_name_tuple</span> <span class="ruby-identifier">l_spec</span>
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">highest_remote_tup</span>

    <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">highest_remote_tup</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">result</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-oldest_supported_version" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">oldest_supported_version</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Oldest version we support downgrading to. This is the version that originally ships with the first patch version of each ruby, because we never test each ruby against older rubygems, so we can’t really guarantee it works. Version list can be checked here: <a href="https://stdgems.org/rubygems">stdgems.org/rubygems</a></p>

                              <div class="method-source-code" id="oldest_supported_version-source">
            <pre><span class="ruby-comment"># File rubygems/commands/update_command.rb, line 327</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">oldest_supported_version</span>
  <span class="ruby-ivar">@oldest_supported_version</span> <span class="ruby-operator">||=</span>
    <span class="ruby-keyword">if</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">ruby_version</span> <span class="ruby-operator">&gt;</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;3.1.a&quot;</span>)
      <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;3.3.3&quot;</span>)
    <span class="ruby-keyword">elsif</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">ruby_version</span> <span class="ruby-operator">&gt;</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;3.0.a&quot;</span>)
      <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;3.2.3&quot;</span>)
    <span class="ruby-keyword">elsif</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">ruby_version</span> <span class="ruby-operator">&gt;</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;2.7.a&quot;</span>)
      <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;3.1.2&quot;</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;3.0.1&quot;</span>)
    <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>.</p><p><a href="https://jamesbritt.bandcamp.com/">Maximum R+D</a>.  </p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

